package com.rizzo.shell.intern;

import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.shell.plugin.PromptProvider;
import org.springframework.stereotype.Component;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Component
@Order(Ordered.LOWEST_PRECEDENCE)
public class RizzoPromptProvider implements PromptProvider {

    @Override
    public String getPrompt() {
        try {
            return InetAddress.getLocalHost().getHostName() + " - rizzo-shell > ";
        } catch (UnknownHostException e) {
            return "unknown_host" + " - rizzo-shell > ";
        }
    }

    @Override
    public String name() {
        return "Rizzo prompt provider";
    }

}
